<?php 
include ('controllers/wall/controller.php');

$con = new Wallcontroller($registry)
?>

<script type="text/javascript">

	// <![CDATA[

	$(document).ready(function(){

		$('#shareButton').click(function(){

			var a = $("#watermark").val();
			if(a != "What's on your mind?")
			{
				$.post("posts.php?value="+a, {

				}, function(response){

					$('#posting').prepend($(response).fadeIn('slow'));
					$("#watermark").val("What's on your mind?");
				});
			}
		});


		$('.commentMark').livequery("focus", function(e){

			var parent  = $('.commentMark').parent();
			$(".commentBox").children(".commentMark").css('width','320px');
			$(".commentBox").children("a#SubmitComment").hide();
			$(".commentBox").children(".CommentImg").hide();

			var getID =  parent.attr('id').replace('record-','');
			$("#commentBox-"+getID).children("a#SubmitComment").show();
			$('.commentMark').css('width','300px');
			$("#commentBox-"+getID).children(".CommentImg").show();
		});

		//showCommentBox
		$('a.showCommentBox').livequery("click", function(e){

			var getpID =  $(this).attr('id').replace('post_id','');

			$("#commentBox-"+getpID).css('display','');
			$("#commentMark-"+getpID).focus();
			$("#commentBox-"+getpID).children("CommentImg").show();
			$("#commentBox-"+getpID).children("a#SubmitComment").show();
		});

		//SubmitComment
		$('a.comment').livequery("click", function(e){

			var getpID =  $(this).parent().attr('id').replace('commentBox-','');
			var comment_text = $("#commentMark-"+getpID).val();

			if(comment_text != "Write a comment...")
			{
				$.post("add_comment.php?comment_text="+comment_text+"&post_id="+getpID, {

				}, function(response){

					$('#CommentPosted'+getpID).append($(response).fadeIn('slow'));
					$("#commentMark-"+getpID).val("Write a comment...");
				});
			}

		});

		//more records show
		$('a.more_records').livequery("click", function(e){

			var next =  $('a.more_records').attr('id').replace('more_','');

			$.post("posts.php?show_more_post="+next, {

			}, function(response){
				$('#bottomMoreButton').remove();
				$('#posting').append($(response).fadeIn('slow'));

			});

		});

		//deleteComment
		$('a.c_delete').livequery("click", function(e){

			if(confirm('Are you sure you want to delete this comment?')==false)

			return false;

			e.preventDefault();
			var parent  = $('a.c_delete').parent();
			var c_id =  $(this).attr('id').replace('CID-','');

			$.ajax({

				type: 'get',

				url: 'delete_comment.php?c_id='+ c_id,

				data: '',

				beforeSend: function(){

				},

				success: function(){

					parent.fadeOut(200,function(){

						parent.remove();

					});

				}

			});
		});

		/// hover show remove button
		$('.friends_area').livequery("mouseenter", function(e){
			$(this).children("a.delete").show();
		});
		$('.friends_area').livequery("mouseleave", function(e){
			$('a.delete').hide();
		});
		/// hover show remove button


		$('a.delete').livequery("click", function(e){

		if(confirm('Are you sure you want to delete this post?')==false)

		return false;

		e.preventDefault();

		var parent  = $('a.delete').parent();

		var temp    = parent.attr('id').replace('record-','');

		var main_tr = $('#'+temp).parent();

			$.ajax({

				type: 'get',

				url: 'delete.php?id='+ parent.attr('id').replace('record-',''),

				data: '',

				beforeSend: function(){

				},

				success: function(){

					parent.fadeOut(200,function(){

						main_tr.remove();

					});

				}

			});

		});

		$('textarea').elastic();

		jQuery(function($){

		   $("#watermark").Watermark("What's on your mind?");
		   $(".commentMark").Watermark("Write a comment...");

		});

		jQuery(function($){

		   $("#watermark").Watermark("watermark","#369");
		   $(".commentMark").Watermark("watermark","#EEEEEE");

		});

		function UseData(){

		   $.Watermark.HideAll();

		   //Do Stuff

		   $.Watermark.ShowAll();

		}

	});

	// ]]>

</script>



<div id="main">
			
				<div id="rightside">
					<div style="text-align:center; padding-top: 5px;">
						<img src="uploads/profile/{profile_photo}" />
					</div>
					<div style="padding: 5px;">
					<h2>{profile_name}</h2>
						<h2>Friends</h2>
						<ul>
							<!-- START profile_friends_sample -->
							<li><a href="profile/view/{ID}">{users_name}</a></li>
							<!-- END profile_friends_sample -->
							<li><a href="relationships/all/{p_user_id}">View all</a></li>
							<li><a href="relationships/mutual/{p_user_id}">View mutual friends</a></li>
						</ul>
						<h2>Rest of my profile</h2>
						<ul>
							<li><a href="profile/statuses/{profile_user_id}">Status updates</a></li>
						</ul>
					</div>
				</div>
				
				<div id="content"><h1>Recent updates</h1>
		<div align="center">

			<form action="" method="post" name="postsForm">

				<div class="UIComposer_Box">

					<span class="w"> <textarea class="input" id="watermark"
							name="watermark" style="height: 20px" cols="60"></textarea> </span>

					<br clear="all" />

					<div align="left" style="height: 30px; padding: 10px 5px;">


						<a id="shareButton" style="float: left" class="smallbutton Detail">
							Share</a>

					</div>

				</div>

			</form>

			<br clear="all" />

			<div id="posting" align="center">

			<?php 
			include('controllers/wall/dbcon.php');

			include_once('controllers/wall/posts.php');
			
			
		
			?>
			
			</div>
		</div>

		 <br clear="all" /> 
		
		
		
		{status_update}
		<!-- {status_update_message} -->
				
						<!-- START updates -->
						{update-{ID}}
						<!-- END updates -->	

		
					
					
					
 

				



 					
					
				</div>
			</div>